import React from 'react'
import ReactDOM from 'react-dom'
import Notification, { NotificatonProps } from './Notification'
import { Color } from './Notification'
import createContainer from './createContainer'
import NotificationsManager from './NotificationsManager'
const containerElement = createContainer()
let notify: (params: NotificatonProps) => void
ReactDOM.render(
	<NotificationsManager
		setNotify={(notifyFn) => {
			notify = notifyFn
		}}
	/>,
	containerElement
)

export { Notification, Color }
export function info(
	children: { title: string; moid: string },
	autoClose: any,
	color?: string,
	typeText?: string,
	timeDelly?: number
) {
	let params: NotificatonProps = {
		children,
		autoClose,
		color,
		typeText,
		timeDelly,
	}
	notify(params)
}
export function error(
	children: { title: string; moid: string },
	autoClose: any,
	color?: string,
	typeText?: string,
	timeDelly?: number
) {
	let params: NotificatonProps = {
		children,
		autoClose,
		color,
		typeText,
		timeDelly,
	}
	notify(params)
}
